package com.example.user;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author wangbin
 */
@RestController
public class UserController {
    @Resource
    private UserRepository userRepository;

    @GetMapping("/oauth/user")
    @PreAuthorize("hasAuthority('ADMIN')")
    public Page<User> list(Pageable pageable) {
        return userRepository.findAll(pageable);
    }
}
